<?php
session_start();

if (!isset($_SESSION["userID"]))
	header("location: login.php");

require_once '../lib/ServicoNoticia.php';

if (isset($_REQUEST["id"]))
	$obj["id"] = $_REQUEST["id"];

$obj["titulo"] = $_REQUEST["titulo"];
$obj["texto"] = $_REQUEST["texto"];
$result = ServicoNoticia::gravarNoticia($obj);

if ($result=="")
	header("location: listarNoticias.php");
else
	print('<script>javascript:history.go(-1)"</script>');

?>